//
//  MobileConfigChecker.m
//  gdemm
//
//  Created by 乔明超 on 16/11/16.
//  Copyright © 2016年 Goldencis. All rights reserved.
//

#import "MobileConfigChecker.h"
#import "MobileConfig.h"
#import "ExamineManager.h"
@interface MobileConfigChecker()
@property (nonatomic,assign) BOOL mIsInstall;
@end

@implementation MobileConfigChecker
static MobileConfigChecker *mInstance;
+ (instancetype)getInstance{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        mInstance = [[self alloc]init];
    });
    return mInstance;
    
}

//重写父类的方法
- (NSString *)getExamineDesc{
    return @"描述文件安装检测";
}

- (NSInteger)getRepairType{
    return RT_AUTO;
}


- (BOOL)run{
    [self reportExamineInfo:[NSString stringWithFormat:@"MobileConfigCheck&检查描述文件是否安装&0"]];
    [NSThread sleepForTimeInterval:0.2];
    if ([MobileConfig IsMobileConfigInstalled]) {
        _mIsInstall = YES;
    }else{
        _mIsInstall = NO;
    }
    
    if (_mIsInstall) {
        [[ExamineManager getInstance].examineResult setValue:@1 forKey:EXAMINE_CONFIG_STATUS_TAG];//测评安全
        [self reportExamineInfo:[NSString stringWithFormat:@"MobileConfigCheck&描述文件已安装&1"]];
    }else{
    
        [[ExamineManager getInstance].examineResult setValue:@"mobileConfileNotInstalled" forKey:EXAMINE_CONFIG_STATUS_TAG];//测评不安全
        [self reportExamineInfo:[NSString stringWithFormat:@"MobileConfigCheck&描述文件未安装&0"]];
    }
    
    return _mIsInstall;
}

- (id)details{
    return nil;
}

- (NSInteger)getExamineContentCount{
    return 3;
}

- (BOOL)returnValue{
    return _mIsInstall;
}

- (void)reset{
    _mIsInstall = NO;
}
@end
